package three;

import java.util.Scanner;

public class test8595 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] v = new int[n + 1];
        int[] k = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            v[i] = scanner.nextInt();
        }
        for (int i = 1; i <= n; i++) {
            k[i] = scanner.nextInt();
        }
        int m = scanner.nextInt();
//        设d[i,j]:表示前i种钱币组成面值j分的方法数
        int[][] d = new int[n + 1][m + 1];
//        假设c[i][j]表示：选择前i种面值的钱，凑成面值j的最少张数，这里1<=i<=n, 0<=j<=m。
        int[][] c = new int[n + 1][m + 1];
        q(n, m, v, k, d);
        System.out.println(d[n][m]);
        p(n, m, v, k, c);
        if (c[n][m] == 2147483647) {
            System.out.println("no possible");
        } else
            System.out.println(c[n][m]);
//        for (int i = 1; i <= n; i++) {
//            for (int j = 1; j <= m; j++) {
//                System.out.print(c[i][j] + " ");
//            }
//            System.out.println();
//        }
    }

    private static void p(int n, int m, int[] v, int[] k, int[][] c) {
        for (int i = 1; i <= n; i++) {
            c[i][0] = 0;
        }
        for (int j = 1; j <= m; j++) {
            if (j % v[1] == 0 && j / v[1] <= k[1]) {
                c[1][j] = (int) j / v[1];
            } else {
//                定义最大值
                c[1][j] = 2147483647;
            }
        }
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                int p = Math.min(j / v[i], k[i]);
                int min = c[i - 1][j];
                for (int t = p; t >= 0; t--) {
                    if (min - t > c[i - 1][j - t * v[i]]) {
                        min = c[i - 1][j - t * v[i]] + t;
                    }
                }
                c[i][j] = min;
            }
        }
    }

    private static void q(int n, int m, int[] v, int[] k, int[][] d) {
        for (int i = 1; i <= n; i++) {
            d[i][0] = 1;
        }
        for (int j = 1; j <= m; j++) {
            if (j % v[1] == 0 && j / v[1] <= k[1]) {
                d[1][j] = 1;
            } else {
                d[1][j] = 0;
            }
        }
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                int min = Math.min(j / v[i], k[i]);
                for (int t = min; t >= 0; t--) {
                    d[i][j] = d[i][j] + d[i - 1][j - t * v[i]];
                }
            }
        }
    }
}
